package ooday03;

public class RefArrayDemo {
    public static void main(String[] args) {

//        Dog[] dogs = new Dog[3];
//
//        Chick[] chicks = new Chick[3];
//
//        Fish[] fish =new Fish[3];
        Dog[] dogs = new Dog[3];
        dogs[0] = new Dog("小黑",2,"黑");
        dogs[1] = new Dog("小白",0,"白");
        dogs[2] = new Dog("小灰",1,"灰");
        dogs[2].swim();
        for (int i=0;i< dogs.length;i++){
            System.out.println(dogs[i].name);
            dogs[i].eat();
        }
        System.out.println("--------------------");
        Chick[] chicks =new Chick[2];
        chicks[0] = new Chick("ikun",1,"灰");
        chicks[1] = new Chick("丁真",2,"棕");
        for (int i=0;i< chicks.length;i++){
            System.out.println(chicks[i].name);
            chicks[i].eat();
        }
        System.out.println("--------------------");
        Fish[] fish =new Fish[5];
        fish[0] =new Fish("泡泡",2,"金");
        fish[1] =new Fish("双面龟",3,"绿");
        fish[2] =new Fish("美美",2,"粉");
        fish[3] =new Fish("阿酷",2,"蓝");
        fish[4] =new Fish("赖皮蛇",2,"白");
        for (int i=0;i< fish.length;i++){
            System.out.println(fish[i].name);
            fish[i].eat();
        }


    }
}
